/********************************************************************
	created:	2012/02/26   23:21
	filename: 	hy_define.h
	author:		supercaco@sina.com
	purpose:	
*********************************************************************/
#ifndef _HY_DEFINE_H_
#define _HY_DEFINE_H_

//for null
#ifndef NULL
#include <cstddef>
#endif

typedef char            hy_i8_t;
typedef unsigned        hy_u8_t;

typedef short			hy_i16_t;
typedef unsigned short  hy_u16_t;

typedef int				hy_i32_t;
typedef unsigned int	hy_u32_t;

#if defined (_WIN32) //&& defined(_MSC_VER)
	typedef __int64		hy_i64_t;
#else
	typedef long long		hy_i64_t;
#endif


typedef float			hy_f32_t;
typedef double			hy_f64_t;


//////////////////////////////////////////////////////////////////////////
#ifdef _WIN32
	#include <winsock2.h>
#else
	#include <sys/ioctl.h>
	#include <sys/poll.h>
	#include <sys/epoll.h>
	#include <sys/types.h>
	#include <sys/time.h>
	#include <sys/select.h>
	#include <sys/socket.h>
	#include <sys/uio.h>
	#include <sys/un.h>
	#include <netinet/in.h>
	#include <netinet/tcp.h>
	#include <arpa/inet.h>
	#include <netdb.h>
	#include <net/if.h>
	#include <limits.h>
	#include <pthread.h>
	
#endif //_WIN32



#ifdef _WIN32
	#define IPV6_V6ONLY			27
	#define HY_INVALID_SOCKET   INVALID_SOCKET  	
	typedef SOCKET				hy_socket_t;
	typedef int					socklen_t;
//	typedef in6_addr			in6_addr_type;
#else
	#define HY_INVALID_SOCKET	-1
	typedef int					hy_socket_t;
	typedef pthread_t			hy_thread_t;
#endif

#define HY_MAX_U32		0xffffffff

//debug macro
#ifndef HY_DEBUG
	#define HY_DEBUG
#endif



#ifndef HY_OS_ERROR
	#define HY_OS_ERROR -1
#endif


#endif  //_HY_DEFINE_H_
